#ifndef __H_LIGHT_CALC__
#define __H_LIGHT_CALC__

#include "const_define.fx"

float4 CalcDiffuse(float3 lightDir, float3 normal, float4 diffuse)
{
	return diffuse * max(0, dot(normal, lightDir));
}

float4 CalcSpecular(float3 position, float3 normal, float4 specular, float shininess)
{
	float3 posWorld = mul(float4(position, 1.0f), MAT_WORLD).xyz;
	float3 lookDir = normalize(eyePos - posWorld);
	float3 H = normalize(lookDir + lightDirection);

	return specular * pow(max(0.000001f, dot(H, normal)), shininess);
}

float4 CalcSpecularLookDir(float3 lookDir, float3 normal, float4 specular, float shininess)
{
	float3 H = normalize(lookDir + lightDirection);
	return specular * pow(max(0.000001f, dot(H, normal)), shininess);
}

#endif // __H_LIGHT_CALC__